using System.Buffers;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using static UnityEngine.RuleTile.TilingRuleOutput;

public class UpgradeNecromancy:Upgrade {



	protected override void ReloadingEventHandler(object _sender,ReloadEventArgs e) {
		base.ReloadingEventHandler(_sender,e);
		float damageAmount = e.ammoAdded*0.1f;
		if(damageAmount>=weapon.owner.HP-1) damageAmount=weapon.owner.HP-1;
		DamageStats damage = new DamageStats();
		damage.amount=damageAmount;
		damage.damageType=DamageType.Pure;
		damage.attackerMob=weapon.owner;
		damage.attackerWeapon=weaponWeapon;
		weapon.owner.Damage(damage);
	}

	protected override void MobDamagedEventHandler(object _sender,DamageEventArgs e) {
		base.MobDamagedEventHandler(_sender,e);
		Mob sender = _sender as Mob;
		if(sender.HP>0) return;
		sender.Forget();

		Debug.Log(sender.lastDamageMob);

		sender.IncreaseMaxHP(-0.5f*sender._maxHP,this);

		DamageStats damage = new DamageStats(_amount:-99999,_damageType:DamageType.Healing);
		sender.Damage(damage);
		sender.faction=weapon.owner.faction;
	}

}
